import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
} from '@nestjs/common';
import { AcrossService } from './across.service';
import { CreateAcrossDto } from './dto/create-across.dto';
import { UpdateAcrossDto } from './dto/update-across.dto';

@Controller('across')
export class AcrossController {
  constructor(private readonly acrossService: AcrossService) {}

  @Post('many')
  async createMany(@Body() createAcrossDtoArr: CreateAcrossDto[]) {
    return await this.acrossService.createMany(createAcrossDtoArr);
  }

  @Delete('many/:id')
  removeMany(@Param('id') id: string) {
    return this.acrossService.removeMany(+id);
  }

  @Get()
  async findAll(@Query() args = {}) {
    return this.acrossService.findAll(args);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.acrossService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateAcrossDto: UpdateAcrossDto) {
    return this.acrossService.update(+id, updateAcrossDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.acrossService.remove(+id);
  }
}
